package main

import (
	"fmt"
	"net"
)

// socket client
func main() {

	clientSocket, err := net.Dial("tcp", "127.0.0.1:10080")
	if err != nil {
		fmt.Println("建立客户端连接err", err)
		return
	}
	inputStr := "this is client input >>>> "
	_, err = clientSocket.Write([]byte(inputStr))
	if err != nil {
		fmt.Println("write err >>", err)
		return
	}
	buf := [512]byte{}
	n, err := clientSocket.Read(buf[:])
	if err != nil {
		fmt.Println("conn.Read error : ", err)
		return
	}
	fmt.Println(string(buf[:n]))
}
